import Component from "./Component";

export default class LoadResData extends Component {

    public static list = [
        "lvup",
        "weapons",
        "inbron",
        "knocking"
    ]
    public static lvupData = null;
    public static weaponsData = null;
    public static inbronData = null;
    public static knockingData = null;
    public static initLoadResData() {
        for (var index in LoadResData.list) {
            if (!LoadResData.list[index]) {
                return;
            }
            LoadResData.getData(LoadResData.list[index]);
        }
    }
    public static getData(str: string) {
        cc.loader.loadRes('json/' + str, function (err, data) {
            cc.log("data", data.json)
            switch (str) {
                case "lvup": {
                    LoadResData.lvupData = data.json;
                    cc.log("lvup", LoadResData.lvupData)
                    break;
                }
                case "weapons": {
                    LoadResData.weaponsData = data.json;
                    cc.log("weapons", LoadResData.weaponsData)
                    break;
                }
                case "inbron": {
                    LoadResData.inbronData = data.json;
                    cc.log("inbron", LoadResData.inbronData)
                    break;
                }
                case "knocking": {
                    LoadResData.knockingData = data.json;
                    cc.log("knocking", LoadResData.knockingData)
                    break;
                }
            }
        });

    }

}
